ext/soap: Fix integer overflow when decoding SOAP array indexes#21963
ext/soap: Fix integer overflow when decoding SOAP array indexes#21963LamentXU123 wants to merge 7 commits intophp:masterfrom
Conversation
|
Plus: Had to fix the bailout logic.... Now in the client side, if I raise a error when overflow is detected, the code will go to master_to_eval() and without xmlFreeDoc(response) and cause a memory leak. So in case of that I just had to add some logic to the bailout process to make sure xmldoc is free, although I hate it (;′⌒`) |
|
looks good, but I ll have another look more toward the end of this week (and likely merging it in the process). Thanks for working on it ! |
|
as mentioned, overall good just few minor nits to address ! |
Thanks for reviewing! The fix should be in place in a couple of minutes. Now I think this is rather a bug fix so it is more proper to rebase this on 8.4 I don't sure if this should be counted as a minor security fix(signed integer overflow) if than this should go to 8.2 |
|
I m not sure it would qualify as actual security fix for 8.2 but let me discuss it internally |
Take your time :) I am first going to rebase this on 8.4 |
SOAP encoded array metadata such as arrayType, offset, and position is parsed into int indexes before being used for array placement. That is, this code:
Will resulted in:
Because the index overflows.
There is a TODO message to fix this. So I think people are aware of this bug before
I therefore wrote this to add checked decimal accumulation for SOAP array indexes and reject values that exceed int range. I Also reject auto-increment past INT_MAX before updating the next array position :)